package org.example.servicefaculty.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.model.manage.bean.po.Major;
import org.example.servicefaculty.mapper.MajorMapper;
import org.example.servicefaculty.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major> implements MajorService {

    @Autowired
    private MajorMapper majorMapper;

    @Override
    public List<Major> getMajorListByFacultyId(Integer facultyId) {
        return majorMapper.selectList(new QueryWrapper<Major>().eq("faculty_id", facultyId));
    }

    @Override
    public Major getMajorById(Integer majorId) {
        return getById(majorId);
    }

    @Override
    public Boolean createMajor(Major major) {
        return save(major);
    }

    @Override
    public Boolean updateMajor(Major major) {
        return updateById(major);
    }
}